#include "stdafx.h"
#include <boost/test/auto_unit_test.hpp>

#include <boost/test/execution_monitor.hpp>
#include "bmock.hpp"
#include "bmock_control_tools_mock.hpp"

struct arg_tester {
	void m(int x, int);
};



static const int x_expected = 6;
static int y_expected = 7;
static const int x_actual = 10;
static int y_actual = 11;

static void f(int x, int) {
	STATIC_MOCK_VOID(2,(IN(x),UNUSED(int)));
}
void arg_tester::m(int x, int) {
	STATIC_MOCK_VOID(2,(IN(x),UNUSED(int)));
}


BOOST_AUTO_TEST_CASE(test_function_unused_arguments_same_input) {
	__BMOCK_CONTROL(c);
	const bmock::control_tools_ptr t(new bmock::control_tools_mock(c));

	__BMOCK_EXPECT_C(c,f(x_expected,y_expected));
	__BMOCK_REPLAY_C(c);
	BOOST_CHECK_NO_THROW(f(x_expected, y_expected));
	__BMOCK_VERIFY_C(c);
}

BOOST_AUTO_TEST_CASE(test_function_unused_arguments_not_same_input) {
	__BMOCK_CONTROL(c);
	const bmock::control_tools_ptr t(new bmock::control_tools_mock(c));

	__BMOCK_EXPECT_C(c,f(x_expected,y_expected));
	__BMOCK_REPLAY_C(c);
	BOOST_CHECK_NO_THROW(f(x_expected, y_actual));
	__BMOCK_VERIFY_C(c);
}

BMOCK_TEST(arg_tester, test_method_unused_arguments_same_input) {
	__BMOCK_CONTROL(c);
	const bmock::control_tools_ptr t(new bmock::control_tools_mock(c));

	__BMOCK_EXPECT_C(c,m(x_expected,y_expected));
	__BMOCK_REPLAY_C(c);
	BOOST_CHECK_NO_THROW(m(x_expected, y_expected));
	__BMOCK_VERIFY_C(c);
}

BMOCK_TEST(arg_tester, test_method_unused_arguments_not_same_input) {
	__BMOCK_CONTROL(c);
	const bmock::control_tools_ptr t(new bmock::control_tools_mock(c));

	__BMOCK_EXPECT_C(c,m(x_expected,y_expected));
	__BMOCK_REPLAY_C(c);
	BOOST_CHECK_NO_THROW(m(x_expected, y_actual));
	__BMOCK_VERIFY_C(c);
}


